from typing import List, Optional
from pydantic import BaseModel, Field
from schemas.base import ResAntTable


class CategoryItem(BaseModel):
    cateid: int
    catename: str
    parentid: int = 0
    catetype: int = 0
    children: Optional[List["CategoryItem"]] = None


class ContentCreate(BaseModel):
    title: str = Field(max_length=255)
    category_id: int
    isnice: bool = False
    istop: bool = False
    islock: bool = False


class ContentItem(BaseModel):
    id: int
    key: int
    title: str
    category_id: int
    isnice: Optional[bool]
    istop: Optional[bool]
    islock: Optional[bool]


class RoleList(ResAntTable):
    data: List[ContentItem]